#include "aim_interfaces/msg/aim_info.hpp"
#include <rclcpp/rclcpp.hpp>
using namespace std;

class ArmorSubscribe : public rclcpp::Node{
public:
    ArmorSubscribe(string name) : Node(name){
        aim_target = this->create_subscription<aim_interfaces::msg::AimInfo>("/aim_target",20,bind(&ArmorSubscribe::aim_callback,this,placeholders::_1));
    }

private:
    rclcpp::Subscription<aim_interfaces::msg::AimInfo>::SharedPtr aim_target;
    void aim_callback(const aim_interfaces::msg::AimInfo msg){
        if(msg.type>6){
            RCLCPP_INFO(get_logger(),"装甲板坐标为:(%u,%u,%u)(单位:mm),装甲板灯条颜色为红色，类型为:%u",msg.coordinate[0],msg.coordinate[1],msg.coordinate[2],msg.type-6);
        }else{
            RCLCPP_INFO(get_logger(),"装甲板坐标为:(%u,%u,%u)(单位:mm),装甲板灯条颜色为蓝色，类型为:%u",msg.coordinate[0],msg.coordinate[1],msg.coordinate[2],msg.type+1);
        }
    }
};

int main(int argc ,char **argv){
    rclcpp::init(argc,argv);
    auto node = make_shared<ArmorSubscribe>("armor_subscribe");
    rclcpp::spin(node);
    rclcpp::shutdown();
}